/**
 * Copyright (c) 2017-2017 All Rights Reserved.
 */
package com.zbest.zpay.exchange.helper;

import java.util.List;
import java.util.Map;

import com.zbest.common.lang.exception.ZpayException;
import com.zbest.zpay.exchange.model.PaycoreBizCode;

/**
 * 
 *
 * @author Administrator
 * @version $Id: AbstractStatusManager.java, v 0.1 2017-5-14 下午9:33:48 Administrator Exp $
 */
public abstract class AbstractStatusManager implements StatusManager {

    /** 
     * @see com.zbest.zpay.exchange.helper.StatusManager#statusCheck(java.lang.String, java.lang.String)
     */
    @Override
    public void statusCheck(String srcStatus, String destStatus) {

        Map<String, List<String>> statusMap = getStatusMap();
        List<String> destStautsList = statusMap.get(srcStatus);
        if (!destStautsList.contains(destStatus)) {
            throw new ZpayException(PaycoreBizCode.STATUS_NOT_ALLOW);
        }
    }

    protected abstract Map<String, List<String>> getStatusMap();

}
